<?php

namespace app\common\model\mysql;

use think\Model;

class WarehouseSpace extends Model
{
    // 设置当前模型对应的完整数据表名称
    protected $table = 'p_warehouse_space';

    /**
     * 查询仓位数据列表
     * @param array $where
     * @param string $field
     * @return OrderProductWater[]|array|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getNormalWarehouseSpace(array $where = [], string $field = "*"){
        $order = [
            "warehouse_space_id" =>"asc",
        ];
        $result = $this->where($where)->field($field)->order($order)->select();
        return $result->toArray();
    }

    /**
     * 查询单个仓位数据
     * @param array $where
     * @param string $field
     * @return OrderProductWater[]|array|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getNormalWarehouseSpaceFind(array $where = [], string $field = "*"){
        $result = $this->where($where)->field($field)->find();
        return $result ? $result->toArray() : [];
    }
}
